<?php
$msgCount = db_factory::get_count("SELECT count(*) FROM `".TABLEPRE."witkey_msg`");
for ($i = 0;$i<$msgCount;$i +=1000){
	$arrMsglists = db_factory::query("SELECT * FROM `".TABLEPRE."witkey_msg` order by msg_id asc limit ".$i.",1000");
	foreach ($arrMsglists as $msginfo){
		if($msginfo['uid'] && $msginfo['to_uid']){
			db_factory::execute("UPDATE `".TABLEPRE."witkey_msg` SET `type`='3' WHERE (`msg_id`='".intval($msginfo['msg_id'])."')");
		}else{
			db_factory::execute("UPDATE `".TABLEPRE."witkey_msg` SET `type`='2' WHERE (`msg_id`='".intval($msginfo['msg_id'])."')");
		}
	}
}
